<?php
/**
 * Created by IDEA.
 * User: dinesh
 * Date: Aug 5, 2013
 * Time: 10:20:58 AM
 * To change this template use File | Settings | File Templates.
 */

class DoseController extends BaseController {
    function actionAdd() {
        $distribution = new Distribution();
        $year = $distribution->getYear();
        $month = $distribution->getMonth();
        $institute = new Institute();
        $instituteList = $institute->getInstituteOptions();
        $this->render('add', array('year' => $year, 'month' => $month, 'institute' => $instituteList));

    }

    function actionGetDoseCollection() {
        $insId = $_POST['institute_id'];
        $secId = $_POST['section_id'];
        $fromYear = $_POST['fyear'];
        $fromMonth = $_POST['fmonth'];
        $toYear = $_POST['tyear'];
        $toMonth = $_POST['tmonth'];
        $dose = new TldCard();
        $data = $dose->getDistributionCollectionWithDose($insId, $secId, $fromYear, $fromMonth, $toYear, $toMonth);
        echo json_encode($data);
    }

    function actionGetDoseCollectionAdmin() {
        $insId = $_POST['institute_id'];
        $secId = $_POST['section_id'];
        $fromYear = $_POST['fyear'];
        $fromMonth = $_POST['fmonth'];
        $toYear = $_POST['tyear'];
        $toMonth = $_POST['tmonth'];
        $dose = new TldCard();
        $data = $dose->getDistributionCollectionWithDoseAdmin($insId, $secId, $fromYear, $fromMonth, $toYear, $toMonth);
        echo json_encode($data);
    }

    function actionAddM() {
        $this->render('addManually');
    }

    function actionMgt() {
        $distribution = new Distribution();
        $year = $distribution->getYear();
        $month = $distribution->getMonth();
        $institute = new Institute();
        $instituteList = $institute->getInstituteOptions();
        $this->render('manage', array('year' => $year, 'month' => $month, 'institute' => $instituteList));
    }


}
